package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicWarehouseBatchInItemDAO;
import com.cssy.xxkj.logic.entity.LogicWarehouseBatchInItemDO;
import com.plat.exception.SyBaseException;

/**
 * 数据访问对象实现类
 * @since 2015-03-03
 */
public class LogicWarehouseBatchInItemDAOImpl extends SqlMapClientDaoSupport implements LogicWarehouseBatchInItemDAO {

    /**
     * 插入数据
     * @param logicWarehouseBatchInItemDO
     * @return 插入数据的主键
     */
    public String insertLogicWarehouseBatchInItemDO(LogicWarehouseBatchInItemDO logicWarehouseBatchInItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicWarehouseBatchInItem.insert", logicWarehouseBatchInItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicWarehouseBatchInItemDO
     * @return 查出的记录数
     */
    public Integer countLogicWarehouseBatchInItemDOByExample(LogicWarehouseBatchInItemDO logicWarehouseBatchInItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicWarehouseBatchInItem.countByDOExample", logicWarehouseBatchInItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicWarehouseBatchInItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicWarehouseBatchInItemDO(LogicWarehouseBatchInItemDO logicWarehouseBatchInItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicWarehouseBatchInItem.update", logicWarehouseBatchInItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicWarehouseBatchInItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicWarehouseBatchInItemDO> findListByExample(LogicWarehouseBatchInItemDO logicWarehouseBatchInItemDO) throws DataAccessException {
        List<LogicWarehouseBatchInItemDO> list = getSqlMapClientTemplate().queryForList("LogicWarehouseBatchInItem.findListByDO", logicWarehouseBatchInItemDO);
        return list;
    }

    /**
     * 根据主键获取logicWarehouseBatchInItemDO
     * @param id
     * @return logicWarehouseBatchInItemDO
     */
    public LogicWarehouseBatchInItemDO findLogicWarehouseBatchInItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicWarehouseBatchInItemDO logicWarehouseBatchInItemDO = (LogicWarehouseBatchInItemDO) getSqlMapClientTemplate().queryForObject("LogicWarehouseBatchInItem.findByPrimaryKey", id);
        return logicWarehouseBatchInItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicWarehouseBatchInItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseBatchInItem.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicWarehouseBatchInItemDO> findLogicWarehouseBatchInItemByMap(
			Map<String, String> parmMap) throws SyBaseException {
		return getSqlMapClientTemplate().queryForList("LogicWarehouseBatchInItem_ex.findByMap", parmMap);
	}

	@Override
	public Integer deleteLogicWarehouseBatchInItemByMap(
			Map<String, String> parmMap) throws SyBaseException {
		Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicWarehouseBatchInItem_ex.deleteByMap", parmMap);
        return rows;
	}

}